﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Core.Enums;
using Core.ReadWriter;

namespace Core.Entities
{
    public delegate BaseReadWriter ReadWriterInitializationDelegate(Type Type, object Object, RWSigns Sign);

    public class DelegateReadWriterInitialization : IReadWriterInitialization
    {

        private readonly ReadWriterInitializationDelegate InitializationMethod;

        public DelegateReadWriterInitialization(ReadWriterInitializationDelegate InitializationMethod)
        {
            if (InitializationMethod == null)
            {
                throw new NullReferenceException("InitializationMethod");
            }

            this.InitializationMethod = InitializationMethod;
        }

        public BaseReadWriter Initialization(Type Type, object Object, RWSigns Sign)
        {
            return InitializationMethod(Type, Object, Sign);
        }
    }
}